Skip to content

fix(decision-context): settle reviewed facts without action authority - #9137

Merged
loopx-agent merged 1 commit into
mainfrom
codex/decision-reviewed-settlement-20261120
Nov 21, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/decision-reviewed-settlement-20261120

Conversation

@huangruiteng

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

Captured sources can contain reviewed new facts without warranting an action proposal. Previously, settlement required either a user-gated proposal or semantic no_change, so this ordinary review could not advance its cursor and release the captured batch.

This adds an explicit observed disposition under the existing Decision Context owner. It requires a material-change semantic rebase, rejects proposal/gate references, and grants no action authority. Preview and execution validate the review chain before appending an event. The existing no_change default and event-derived gated dispositions remain supported.

  • Outcome basis: reproduced missing evidence-only review path; no separate issue is needed for this bounded repair.
  • Intended base: main.
  • Before/after: the new material-review CLI test fails on the base and now completes capture, review, cursor readback, retirement, and a subsequent capture without authorizing an action.

Author Declaration

  • Written by: OpenAI Codex (GPT-6), model_agent.
  • Specification and revision: existing evidence/cursor ownership in docs/reference/protocols/decision-context-architecture-v0.md at eb552a8bb0532de117513ee5277a92e74e746309; the reproduced repair request in this PR is the basis for the additional disposition.
Criterion Disposition Implementation Verification
Reviewed material facts can settle without an action decision implemented packets.py, review_settlement.py, cli.py in loopx/capabilities/decision_context/ Synthetic capture-to-retirement CLI test
Evidence-only review cannot carry action authority or masquerade as quiet no-change implemented packets.py, cursor_commit.py Packet authority assertions and invalid-rebase preview/execute cases
Preserve evidence binding and profile/cursor CAS implemented Reuses the existing review-chain and cursor commit owner Runtime, capture, recovery and isolation regression suite
  • Self-check: read the complete diff and both language mirrors; ran focused regression, static checks, public-boundary checks and catalog-selected validation. No live source content or private runtime configuration is part of this PR.

Scope And Continuation

Complete within the public capability scope. Provider schedules and semantic review remain owned by their integrations. The new disposition does not infer review from collection, authorize an action, or acknowledge unread historical batches. No new provider or parallel state owner is introduced.

Validation

  • Tested revision: 57e5b175cf3b170cd25f0a769617a326d643ab0b (focused tests exercised the identical diff before commit).
  • Run state: finished.
  • Input classes: synthetic.
Check kind Result Evidence / limitation
regression_parity passed Newly added semantic cases reproduced the missing behavior on the base: 7 failed, 2 passed.
unit / integration passed 111 tests across test_decision_context_packets.py, test_decision_context_runtime.py, test_decision_context_capture.py, test_decision_context_capture_recovery.py and test_decision_context_capture_isolation.py.
real_entrypoint passed Synthetic source through the real CLI: preview writes nothing; observed settlement records no gate, commits the cursor, releases the batch, and permits another capture.
static passed Ruff for changed Python, diff hygiene, bilingual protocol review and RFC diff check.
integration / static passed Standard loopx canary premerge --from-git-diff --git-diff-base origin/main: 6 direct checks and 18 selected checks, zero failures or warnings, at the tested commit.
manual passed Explicit path staging and complete public/private diff inspection.
  • Coverage and gaps: no model or external provider is needed for the disposition contract. Provider-specific collection and integration scheduling are outside this public diff. The first premerge run lacked the repository TypeScript dev dependency; after npm ci --ignore-scripts, the isolated check and the full standard run passed. Passing validation is not merge authorization.

Frontend / Visual Evidence

  • UI impact: none. CLI semantics and protocol documentation only; screenshots are not applicable.

Type of Change

  • Bug fix
  • Documentation update
  • Test update

LoopX Area

  • Capability or extension (providers, adapters, skills)

Shared-authority RFC fixture impact

N/A: this PR does not claim a TypeScript migration or shared-authority promotion.

Boundary Checklist

  • Diff and description contain no private source content, credentials, raw traces, internal links or local machine paths.
  • No maintainer-owned benchmark work is duplicated.
  • The change stays within the reproduced settlement gap.
  • No paired RFC changed; capability and protocol English/Chinese mirrors are updated together.
  • UI impact is none.
  • The commit has a DCO sign-off.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google DeepMind · self_reported

已基于 origin/main(eb552a8bb0532de117513ee5277a92e74e746309)与精确远端提交 57e5b175cf3b170cd25f0a769617a326d643ab0b 完成全文 diff 审查、基线对照与本地实测验证,结论为 APPROVE,未发现阻塞合并的 P1/P2 缺陷。

动机 / Motivation

本次改动面向在 Decision Context 增量采集与复核流程中调用 settle_profile_decision_review 或 loopx decision-context settle-review 的 Agent 与私有适配器。在原有实现中,当增量来源读到新事实(semantic_rebase 为 material_change)但审阅后判断无需发起行动建议时,系统只有用户门控事件(approve / reject / defer)与语义 no_change 两条退出路径。

变更前:当增量来源产生新事实(material_change)但无需提出行动建议时,省略 --source-event-id 会回退为 no_change 并因缺少 semantic_no_change 证明报错,导致私密 cursor 无法推进且采集队列一直残留待处理批次;变更后:显式传入 --disposition observed 即可在验证 material_change 语义重算后提交私密 cursor 并释放采集批次,同时保持 authority_confirmed=false 与 quiet_noop=false。这带来了明确的收益:新增显式 observed 处置状态:支持无 --proposal-json 与 --source-event-id 的事实复核结算,校验 semantic_rebase 为 material_change 且 quiet_noop_allowed 为 false,写入 quiet_noop=false 的 validation 事件并完成 CAS cursor 提交与采集批次释放。同时,PR 边界克制:不引入新的自动化审批或行动授权,不修改 Core user_gate/todo/quota 语义,不默认开启 Decision Context,也不扩展到 Outcome Receipt 或 Reward Memory 候选自动入库。

改动思路 / Approach

PR 直接复用 Decision Context 既有责任分层,没有另建平行状态文件或采集退役分支:本改动严格复用 packets.py、cursor_commit.py、review_settlement.py 与 cli.py 的既有职责边界,未新增并行状态机、未泄漏原始正文、也未授予任何行动权限。其中,因为仅靠 material_change 无法区分“审阅后刻意不行动”和“误漏了 user gate 提案”,显式传入 observed 属于不可归约的调用方意图,而是否具备结算资格则直接由既有的 semantic_rebase.status 与 quiet_noop_allowed 派生。当前 PR 边界聚焦在为无行动建议的新事实评审增加显式 observed 结算通路并释放采集批次,不触及 Outcome Receipt 与 Core gate 逻辑。

结算路径 是否需要 --proposal-json / --source-event-id 允许的 semantic_rebase 前提 authority_confirmed quiet_noop
approve / reject / defer 必须匹配有效 user_gate 事件与提案 不要求 no_material_change true false
no_change(省略 --disposition 默认值) 禁止传入 status == "no_material_change" 且 quiet_noop_allowed is True false true
observed(本次新增) 禁止传入 status == "material_change" 且 quiet_noop_allowed is False false false

具体改动 / Changes

全量改动共 11 个文件(+203/-22):4 个 Python 运行时模块(+53/-9)、4 份中英文协议与能力文档(+28/-11)、3 个测试文件(+122/-2)。

关键代码讲解

  1. DECISION_REVIEW_DISPOSITIONS(loopx/capabilities/decision_context/packets.py#L37-L43):在规范集合中新增 "observed",保持封闭集合校验。
  2. build_decision_review_receipt(loopx/capabilities/decision_context/packets.py#L470-L560):将门控判断显式收束为 gated = normalized_disposition in {"approve", "reject", "defer"};对 "observed" 同样禁止绑定 proposal_packet_ref、gate_todo_id、source_event_id,且固定输出 authority_confirmation_required=False、authority_confirmed=False、outcome_observation_required=False,并仅在 "no_change" 时将 quiet_noop 设为 True。
  3. _validate_review_packet_chain(loopx/capabilities/decision_context/cursor_commit.py#L197-L296):保留 no_change 对 no_material_change + quiet_noop_allowed=True 的严格校验,新增 observed 分支要求 semantic_rebase.status == "material_change"、quiet_noop_allowed is False 且 proposal is None;空 rebase("incomplete")仍被两条无门控路径拒绝。
  4. settle_profile_decision_review(loopx/capabilities/decision_context/review_settlement.py#L22-L155):新增可选参数 disposition: str | None = None。传入 source_event_id 时禁止覆盖处置结果;未传 source_event_id 时拒绝 proposal,缺省仍回落为 "no_change",显式传入只允许 {"no_change", "observed"};预览与写入前统一调用 _validate_review_packet_chain,并在 validation 事件和返回包中将 quiet_noop 设为 disposition == "no_change"。
  5. register_decision_context_commands / handle_decision_context_command(loopx/capabilities/decision_context/cli.py#L243-L275,#L420-L447):在 settle-review 子命令新增 --disposition(choices=("no_change", "observed"),默认为 None)并透传给 settle_profile_decision_review。

依据规范文档 docs/reference/protocols/decision-context-architecture-v0.md(不可变基线 eb552a8bb0532de117513ee5277a92e74e746309):

  • DC-INV-3(无行动授权隔离):implemented(packets.py#build_decision_review_receipt,由 test_observed_review_records_facts_without_authorizing_action 验证)。
  • DC-INV-8(结算校验与写入后方提交私密游标):implemented(cursor_commit.py#_validate_review_packet_chain,由 test_material_review_cli_releases_capture_without_authorizing_action 验证)。
  • DC-INV-9(无门控结算必须具备有效语义重算证明而非空 rebase):implemented(review_settlement.py#settle_profile_decision_review,由 test_observed_settlement_requires_material_review_before_any_write 验证)。
  • PR 同步修订规范中 decision_review_receipt_v0 以容纳 observed,属于消除真实采集死锁的合理补齐,且未放宽任何 Core 权限约束。

语义与 CI 对齐

经核查 loopx/semantics/vocabulary_v0.json 与已通过的 examples/semantic-vocabulary-drift-smoke.py,本次仅扩展能力内部封闭词表 DECISION_REVIEW_DISPOSITIONS(extend_vocabulary),未改写跨控制面词汇表,也未改变 semantic_rebase.status 取值,满足仓库语义对齐与默认关闭隔离约束。

对主干的风险 / Risks

未发现阻塞主干合入的 P1/P2 回归风险。围绕最强失效与绕过场景进行了本地验证(均为 PASS):

  1. 负向与门控防绕过校验:实测确认当省略 --disposition 结算 material_change 时仍按 no_change 拒绝;将 observed 用于空 rebase(incomplete)或 semantic_no_change=True 时在预览及执行阶段均于写入前抛出 ValueError;observed 与 proposal 或 source_event_id 混用、或未提供 source_event_id 传入 disposition="approve"、以及篡改 quiet_noop_allowed=True 均被拒绝且不改动事件日志或私密 cursor。
  2. 端到端采集闭环与幂等重放:test_material_review_cli_releases_capture_without_authorizing_action 与基线对照实验验证 settle-review --disposition observed 在预览时不落盘,在 --execute 时写入 validation 事件并原子推进私密 cursor,重复执行返回 status="replayed",随后 capture tick 成功清除待审批次并在后续文件再次修改时恢复捕获新批次。
  3. 残余与非阻塞边界:decision-context-architecture-v0.{md,zh-CN.md} 中 Mermaid 图(L139)与流程说明段落(L236-L238、L274-L275)、README.{md,zh-CN.md} 摘要条目(#5 与成熟度总结)、catalog_entry.py#L146 及 examples/decision-context-contract-smoke.py 仍主要列举四类旧处置名称;另外 mypy --follow-imports=silent 在未修改的 cli.py:381 存在基线既有类型报错,本次修改行及另外 3 个运行时文件均为 0 报错。

我的整体评价 / Verdict

判定:精确覆盖范围清晰、默认关闭隔离完整(inspect-profile 禁用态及省略 --disposition 行为与 origin/main 完全等价)、未新增冗余状态或外部副作用,建议 APPROVE。

  • 长程与用户体验评估(outcome_impact):long_horizon=improved(打通非行动新事实的周期性采集与游标推进闭环,防止采集队列长期堆积阻塞);user_experience=improved(避免为纯阅读性变化强行打断 owner 审批,同时保持默认兼容)。界面视觉评审说明:本次变更为后端 Python 能力契约、CLI 参数与中英文文档,未修改 apps/ 下的前端或聊天展示界面。不存在未验证的 UI 界面范围(unverified_scope: none)。
  • 词汇与体积结论:沿用既有关联词表并小幅扩展 DECISION_REVIEW_DISPOSITIONS(extend_vocabulary),运行时净增仅 +53/-9,无需拆分或重写;建议后续单独小步补齐架构文档中剩余 2 处枚举摘要与 examples/decision-context-contract-smoke.py 对 observed 的覆盖。
  • 本地验证记录(未依赖远程 CI):
    • tests/capabilities/test_decision_context_*.py + tests/test_decision_context_material.py + tests/presentation/test_decision_context_api.py + tests/test_capability_code_maps.py:PASS(230 passed, 0 skipped)
    • 含 tests/test_windows_atomic_writes.py 联合测试集:PASS(236 passed;3 skipped 均为 macOS 环境下 Windows 扩展路径 IO 用例)
    • tests/architecture 与 tests/control_plane 公共安全测试集:PASS(357 passed)
    • examples/decision-context-contract-smoke.py 与 examples/decision-material-walkthrough-smoke.py(隔离环境):PASS
    • ruff check(7 个改动 Python 文件)与 check_rfc_bilingual.py:PASS
    • loopx canary premerge --from-git-diff --git-diff-base origin/main --tier standard:PASS(18/18 checks passed, 0 failures)
    • mypy --follow-imports=silent(4 个运行时文件):修改行与其余 3 个文件 0 错误;cli.py:381 存在基线既有的 1 处类型赋值报错
    • 不可变基线(eb552a8bb0532de117513ee5277a92e74e746309)vs 57e5b175cf3b170cd25f0a769617a326d643ab0b 行为对照:PASS

English verdict: APPROVE

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)

动机 / Motivation

持续读取 Decision Context 来源的维护者,需要确认已复核的新事实并腾出位置继续采集。 遇到有实质变化但无需发起行动的证据,旧 CLI 没有相应的结算方式,尝试显式结算会被拒绝。 候选允许记录已复核的新事实,读回无行动权限的结算回执,并继续采集下一批来源。 独立验证覆盖源码 CLI、隔离的文件来源、SQLite 采集队列和本地事件读回。未复验已安装发行版和外部真实来源。

改动思路 / Approach

复用原有评审结算、游标推进和写回读回,只为现有回执加入一种证据结算状态。 当前交付的结算边界由 loopx/capabilities/decision_context/review_settlement.py 负责。调用者先预览语义校验,再执行原有结算并读回游标。需要行动授权时,原路径仍精确读取已经写下的 owner gate。

具体改动 / Changes

评审精确头 57e5b175cf3b170cd25f0a769617a326d643ab0b。补丁在本次验证使用的主干上可干净整合。

关键代码讲解

  • material-evidence-only-settlement 由现有结算入口验证待处理的证据和语义重算。只有真实材料变化可进入 observed,回执拒绝 proposal 和 gate 引用。通过校验后,执行沿用验证事件、游标写回和读回。 结算入口 回执 游标验证
  • verified-gate-and-no-change-parity 沿用原有 gate 指向和无实质变化判定。CLI 未传 disposition 时维持现有行为。 基线协议 新增回执 写入前校验

对主干的风险 / Risks

精确头和当前主干本地整合树分别通过 111 项。把同一个 CLI 回归放到基线,解析器明确拒绝 --disposition observed。 空 rebase 和无实质变化的 rebase 都不能以 observed 结算。预览和执行都拒绝,事件和游标文件未创建。 隔离 SQL 采集队列在结算后从一批降至零,独立修改来源后重新采得一批。实际回执只含验证事件,authority_confirmed=false。启用分支沿用原 Goal、Agent 和既有游标写回。独立验证覆盖源码 CLI、隔离的文件来源、SQLite 采集队列和本地事件读回。未复验已安装发行版和外部真实来源。

语义与 CI 对齐

扩展的是现有 decision_review_receipt_v0 的 disposition。双语协议公开说明语义,独立矩阵覆盖材料变化、空重算和无变化回归,未查询托管 CI。

我的整体评价 / Verdict

APPROVE。 在已核对的源码路径上,新事实经过复核后可结算并继续采集,旧 gate、quiet no-change 和来源隔离经过回归验证。已安装发行版和外部真实来源仍待验证。

English verdict: APPROVE at 57e5b175cf3b170cd25f0a769617a326d643ab0b. Material evidence can be settled without conferring action authority. Preview rejects missing material proof and existing gated and quiet paths passed regression tests.

@loopx-agent
loopx-agent merged commit 47639fe into main Nov 21, 2026
40 of 52 checks passed
@loopx-agent
loopx-agent deleted the codex/decision-reviewed-settlement-20261120 branch November 21, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants